package it.polimi.TravelDream;

import java.io.Serializable;

import javax.persistence.*;

import java.util.Date;
import java.util.List;


/**
 * The persistent class for the savedpackage database table.
 * 
 */
@Entity
@NamedQueries({
		@NamedQuery(name="Savedpackage.findAll", query="SELECT s FROM Savedpackage s"),
		@NamedQuery(name="Savedpackage.searchByID", query="SELECT s FROM Savedpackage s WHERE s.id LIKE :param1"),
		@NamedQuery(name="Savedpackage.searchByOwner",query="SELECT s FROM Savedpackage s WHERE s.user.id LIKE :param1")
		})
public class Savedpackage implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;

	private String arrLocation;

	@Temporal(TemporalType.DATE)
	private Date confDate;

	private boolean confirmed;

	private int creatorPeople;

	@Temporal(TemporalType.DATE)
	private Date depDate;

	private String depLocation;

	private int hotToBeP;

	private int outToBeP;

	@Temporal(TemporalType.DATE)
	private Date retDate;

	private int retToBeP;

	@Temporal(TemporalType.DATE)
	private Date saveDate;

	private int totPeople;

	//bi-directional many-to-one association to Packagejoin
	@OneToMany(mappedBy="savedpackage", cascade=CascadeType.REMOVE)
	private List<Packagejoin> packagejoins;

	//bi-directional many-to-one association to Packexlinker
	@OneToMany(mappedBy="savedpackage", cascade=CascadeType.REMOVE)
	private List<Packexlinker> packexlinkers;

	//bi-directional many-to-one association to Payment
	@OneToMany(mappedBy="savedpackage")
	private List<Payment> payments;

	//bi-directional many-to-one association to Flight
	@ManyToOne
	@JoinColumn(name="OutFlyID")
	private Flight flight1;

	//bi-directional many-to-one association to Flight
	@ManyToOne
	@JoinColumn(name="RetFlyID")
	private Flight flight2;

	//bi-directional many-to-one association to Hotel
	@ManyToOne
	@JoinColumn(name="HotelID")
	private Hotel hotel;

	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="Owner")
	private User user;

	public Savedpackage() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getArrLocation() {
		return this.arrLocation;
	}

	public void setArrLocation(String arrLocation) {
		this.arrLocation = arrLocation;
	}

	public Date getConfDate() {
		return this.confDate;
	}

	public void setConfDate(Date confDate) {
		this.confDate = confDate;
	}

	public boolean getConfirmed() {
		return this.confirmed;
	}

	public void setConfirmed(boolean confirmed) {
		this.confirmed = confirmed;
	}

	public int getCreatorPeople() {
		return this.creatorPeople;
	}

	public void setCreatorPeople(int creatorPeople) {
		this.creatorPeople = creatorPeople;
	}

	public Date getDepDate() {
		return this.depDate;
	}

	public void setDepDate(Date depDate) {
		this.depDate = depDate;
	}

	public String getDepLocation() {
		return this.depLocation;
	}

	public void setDepLocation(String depLocation) {
		this.depLocation = depLocation;
	}

	public int getHotToBeP() {
		return this.hotToBeP;
	}

	public void setHotToBeP(int hotToBeP) {
		this.hotToBeP = hotToBeP;
	}

	public int getOutToBeP() {
		return this.outToBeP;
	}

	public void setOutToBeP(int outToBeP) {
		this.outToBeP = outToBeP;
	}

	public Date getRetDate() {
		return this.retDate;
	}

	public void setRetDate(Date retDate) {
		this.retDate = retDate;
	}

	public int getRetToBeP() {
		return this.retToBeP;
	}

	public void setRetToBeP(int retToBeP) {
		this.retToBeP = retToBeP;
	}

	public Date getSaveDate() {
		return this.saveDate;
	}

	public void setSaveDate(Date saveDate) {
		this.saveDate = saveDate;
	}

	public int getTotPeople() {
		return this.totPeople;
	}

	public void setTotPeople(int totPeople) {
		this.totPeople = totPeople;
	}

	public List<Packagejoin> getPackagejoins() {
		return this.packagejoins;
	}

	public void setPackagejoins(List<Packagejoin> packagejoins) {
		this.packagejoins = packagejoins;
	}

	public Packagejoin addPackagejoin(Packagejoin packagejoin) {
		getPackagejoins().add(packagejoin);
		packagejoin.setSavedpackage(this);

		return packagejoin;
	}

	public Packagejoin removePackagejoin(Packagejoin packagejoin) {
		getPackagejoins().remove(packagejoin);
		packagejoin.setSavedpackage(null);

		return packagejoin;
	}

	public List<Packexlinker> getPackexlinkers() {
		return this.packexlinkers;
	}

	public void setPackexlinkers(List<Packexlinker> packexlinkers) {
		this.packexlinkers = packexlinkers;
	}

	public Packexlinker addPackexlinker(Packexlinker packexlinker) {
		getPackexlinkers().add(packexlinker);
		packexlinker.setSavedpackage(this);

		return packexlinker;
	}

	public Packexlinker removePackexlinker(Packexlinker packexlinker) {
		getPackexlinkers().remove(packexlinker);
		packexlinker.setSavedpackage(null);

		return packexlinker;
	}

	public List<Payment> getPayments() {
		return this.payments;
	}

	public void setPayments(List<Payment> payments) {
		this.payments = payments;
	}

	public Payment addPayment(Payment payment) {
		getPayments().add(payment);
		payment.setSavedpackage(this);

		return payment;
	}

	public Payment removePayment(Payment payment) {
		getPayments().remove(payment);
		payment.setSavedpackage(null);

		return payment;
	}

	public Flight getFlight1() {
		return this.flight1;
	}

	public void setFlight1(Flight flight1) {
		this.flight1 = flight1;
	}

	public Flight getFlight2() {
		return this.flight2;
	}

	public void setFlight2(Flight flight2) {
		this.flight2 = flight2;
	}

	public Hotel getHotel() {
		return this.hotel;
	}

	public void setHotel(Hotel hotel) {
		this.hotel = hotel;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}